<template>
	<view class="mina">
		<view class="status_bar"></view>
		<view class="top_heade">
			<Header color="#fff" title="游戏红包"></Header>
			<view @click="tousu" class="top_wan">
				<!-- <image class="wenhao" src="http://img.cpgm.cc/panda/static/my/wenhao.png" mode=""></image> -->
				<view class="wanfa">
					玩法说明
				</view>
			</view>
		</view>
		<!-- 下面的盒子 -->
		<view class="list_bot">
			<view>
				<view class="list_top">
					<view class="top_t">
						<view class="top_left">
							<view class="top_tit">
								红包余额
							</view>
							<view class="top_blod">
								{{userinfo.red_money?userinfo.red_money:0}}<text>元</text>
							</view>
						</view>
					</view>
					<view @click="tixian" class="btnTx">
						提现
					</view>
					<!-- 下方按钮 -->
				</view>
				<!-- list列表 -->
				<view class="list">
					<scroll-view class="sclass" scroll-y>
						<h3>游戏等级奖励</h3>
						<view class="list_son" v-for="(item,index) in list" :key="index">
							<view class="left_ferter">
								<image class="left_you" src="http://img.cpgm.cc/panda/static/my/hongb.png"></image>
								<view class=" center_you">
									<view class="money">
										单红包最高<text>{{item.money}} </text><text class="yuan">元</text>
									</view>
									<view class="detil">
										{{item.name}}
									</view>
								</view>
							</view>
							<!-- right_you2 -->
							<u-button :plain="true" :hair-line="false" hover-class="none" :throttle-time="1000"
								class="right_you button" :class="[!!item.is_rece?'grey':'']" @click="receive(item)">
								{{!!item.is_rece?'已领取':'领取'}}
							</u-button>
						</view>
					</scroll-view>
				</view>
			</view>
		</view>
		<!-- 玩法说明 -->
		<u-popup mode="center" border-radius="30" v-model="show">
			<view class="warp">
				<view class="tanchu">
					<view class="warps">
						<view class="center_prop">
							<view class="text">
								玩法说明
							</view>
							<!-- <image class="xing" src="http://img.cpgm.cc/panda/static/my/xing.png" mode="widthFix"></image> -->
						</view>
						<!--  -->
						<view class="nei">
							<p>1、自由之刃高爆版达到对应等级即可领取对应红包;</p>
							<p>2、活动真实有效，红包达到2000即可提现;</p>
							<!-- <p>3、加入官方交流群，获得最全最快提现攻略;</p> -->
						</view>
						<!-- btn -->
						<view @click="cha" class="btn_zhi">
							我知道了
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<!-- 投诉弹出层 -->
		<!-- 		<u-popup mode="center" width="80%" border-radius="30" v-model="show4">
			<view class="tanchu">
				<image src="http://img.cpgm.cc/panda/static/my/hongb.png" class="hb" mode="widthFix"></image>
				<view class="center_prop">
					<view class="text">
						恭喜您成功领取
					</view>
				</view>
				<view class="tishi">
					恭喜完成任务获得{{money}}红包奖励
				</view>
				<view class="btn">
					<view @click="querenTs" class="rig_btn button">
						确定
					</view>
				</view>
			</view>
		</u-popup> -->
		<u-mask :show="show4">
			<view class="warpss">
				<view class="top_wa">
					<image src="http://img.cpgm.cc/panda/static/my/hongb.png" class="hongbao" mode="widthFix"></image>
					<view class="top_tit">
						恭喜您成功领取
					</view>
					<view class="pic_num">
						{{money}}<text>元红包</text>
					</view>
					<view @click="querenTs" class="btn_kai">
						开心收下
					</view>
					<!-- 	<view class="tixian">
						红包达到2000元可提现
					</view> -->
				</view>
			</view>
		</u-mask>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				show4: false,
				money: 0,
				list: [{
						id: 1,
						name: '注册《自由之刃高爆版》即可领取',
						money: 2000,
						is_rece: false
					},
					{
						id: 2,
						name: '《自由之刃高爆版》角色等级达到85级',
						money: 2000,
						is_rece: false
					},
					{
						id: 3,
						name: '《自由之刃高爆版》角色等级达到120级',
						money: 2000,
						is_rece: false
					},
					{
						id: 4,
						name: '《自由之刃高爆版》角色等级达到150级',
						money: 2000,
						is_rece: false
					},
					{
						id: 5,
						name: '《自由之刃高爆版》角色等级达到180级',
						money: 2000,
						is_rece: false
					},
					{
						id: 6,
						name: '《自由之刃高爆版》角色等级达到220级',
						money: 2000,
						is_rece: false
					},
					{
						id: 7,
						name: '《自由之刃高爆版》角色等级达到260级',
						money: 2000,
						is_rece: false
					},
					{
						id: 8,
						name: '《自由之刃高爆版》角色等级达到300级',
						money: 2000,
						is_rece: false
					},
					{
						id: 9,
						name: '《自由之刃高爆版》角色等级达到340级',
						money: 2000,
						is_rece: false
					},
					{
						id: 10,
						name: '《自由之刃高爆版》角色等级达到380级',
						money: 2000,
						is_rece: false
					},
					{
						id: 11,
						name: '《自由之刃高爆版》角色等级达到420级',
						money: 2000,
						is_rece: false
					},
					{
						id: 12,
						name: '《自由之刃高爆版》角色等级达到460级',
						money: 2000,
						is_rece: false
					},
					{
						id: 13,
						name: '《自由之刃高爆版》角色等级达到500级',
						money: 2000,

					},
				],
				userinfo: uni.getStorageSync('userinfo'),
			}
		},
		onLoad() {
			this.getUserInfo();
			this.gmMoneyList();
		},
		methods: {
			// 点击确定
			querenTs() {
				this.show4 = false
			},
			// 请求用户信息接口
			async getUserInfo() {
				this.$getUserInfo.getUserInfo((res) => {
					this.userinfo = res.data
				})
			},

			// 获取列表
			async gmMoneyList() {
				let res = await this.$http.index.gmMoneyList();
				if (res.code == 1) {
					for (let i = 0; i < res.data.length; i++) {
						this.list[i] = {
							...this.list[i],
							...res.data[i]
						}
					}
					console.log(this.list);
					this.$forceUpdate()
				}
			},
			scrolltolower() {
				// console.log('123');
			},
			// 点击提现
			tixian() {
				this.$p.navto('/pages/my/envelopes')
			},
			// 点击玩法
			tousu() {
				// console.log('123');
				this.show = true
			},
			cha() {
				this.show = false
			},

			// 领取红包
			async receive(item) {
				let phone_type = this.$u.os()
				if (!!item.is_rece) {
					this.$u.toast('该等级游戏红包已领取')
				} else {
					let res = await this.$http.index.getGameMoney({
						id: item.id,
						phone_type: phone_type
					})
					this.$u.toast(res.msg)
					if (res.code == 1) {
						this.money = res.money
						this.show4 = true
						this.gmMoneyList();
						this.getUserInfo();
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.warpss {

		.top_wa {
			position: relative;
			width: 90%;
			margin: 0 auto;
			margin-top: 60%;
			background: linear-gradient(180deg, #FAD9BF 0%, #FFFFFF 100%);
			box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
			border-radius: 19px;
			padding: 35px 20px 10px 20px;

			.hongbao {
				width: 20%;
				// height: 0px;
				position: absolute;
				top: -50px;
				left: 50%;
				transform: translateX(-50%);
			}

			.top_tit {
				text-align: center;
				margin: 10px;
				font-size: 26px;
				font-family: PingFangSC-Semibold, PingFang SC;
				font-weight: 600;
				color: #000000;
			}

			.pic_num {
				text-align: center;
				font-size: 57px;
				font-family: Futura-Bold, Futura;
				font-weight: bold;
				color: #343434;
				line-height: 75px;
				background: linear-gradient(180deg, #FF2F00 0%, #FF8758 100%);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;

				text {

					font-size: 17px;
					font-family: PingFangSC-Semibold, PingFang SC;
					font-weight: 600;
					color: #696969;
				}
			}

			.btn_kai {
				width: 90%;
				margin: 0 auto;
				height: 57px;
				background: linear-gradient(270deg, #FF456B 0%, #FE5C4F 100%);
				border-radius: 5px;
				font-size: 16px;
				font-family: SourceHanSansCN-Bold, SourceHanSansCN;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 57px;
				text-align: center;
				margin: 10px;
			}

			.tixian {
				text-align: center;
				font-size: 12px;
			}
		}
	}

	.cha {
		width: 50rpx;
		height: 50rpx;
		margin-top: 30rpx;
		margin-left: 50%;
		transform: translateX(-50%);
		// transition: all 2s;
	}

	/deep/.u-mode-center-box {
		background-color: transparent;
	}

	.rig_btn {
		width: 90%;
		height: 35px;
		border-radius: 5px;
		margin: 0 auto;
		background-color: #FC524A;
		color: #fff;
		font-size: 16px;
		font-weight: 600;
		text-align: center;
		line-height: 35px;
		margin-top: 20px;
	}

	.tanchu {
		width: 100%;
		position: relative;
		padding: 20px;
		background: linear-gradient(180deg, #FAD9BF 0%, #FFFFFF 100%);
		box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
		margin: 0 auto;
		border-radius: 15px;
		overflow: hidden;



		.btn_zhi {
			height: 40px;
			background: linear-gradient(275deg, #FE4768 0%, #FF867D 100%);
			border-radius: 5px;
			font-size: 14px;
			font-weight: bold;
			color: #FFFFFF;
			text-align: center;
			line-height: 40px;
			margin: 0 auto;
			margin-top: 30px;
		}

		.nei {
			font-size: 13px;
			font-weight: 500;
			color: #696969;
			line-height: 16px;
			margin-top: 30px;

			p {
				margin: 5px 0;
			}
		}

		.you {
			font-size: 12px;
			font-weight: 600;
			color: #FF456C;
			text-align: center;
			margin-top: 20rpx;
		}

		.fuzhi {
			width: 295rpx;
			height: 78rpx;
			background: linear-gradient(270deg, #FF456B 0%, #FE5C4F 100%);
			border-radius: 39rpx;
			font-size: 13px;
			font-weight: bold;
			color: #FFFFFF;
			text-align: center;
			line-height: 78rpx;
			margin: 0 auto;
			margin-top: 20rpx;
		}
	}

	.center {
		position: relative;
		height: 32rpx;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 41rpx;
		margin-bottom: 80rpx;

		.text {
			font-size: 16px;
			font-weight: bold;
			color: #131314;
			margin: 0 32rpx;
		}

		.xing {
			width: 23rpx;
			height: 23rpx;
		}

		.bg_qiu {
			position: absolute;
			width: 69rpx;
			height: 34rpx;
			border-radius: 20rpx;
			z-index: -1;
			left: 50%;
			transform: translateX(-70%);
			background: linear-gradient(180deg, #AEE4FE 0%, #8BFDC1 100%);
		}
	}

	.center_prop {
		position: relative;
		height: 32rpx;
		width: 100%;
		margin-top: 30px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 20rpx;

		.text {
			font-size: 18px;
			font-weight: bold;
			color: #131314;
		}
	}

	.list {
		padding: 10px;
		box-sizing: border-box;
		background: #F2F2F2;
		border-radius: 18px 18px 0px 0px;
		margin-top: 10px;

		.list_son {
			height: 132rpx;
			width: 100%;
			margin: 8px 0;
			background-color: #fff;
			border-radius: 15rpx;
			padding: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.left_ferter {
				display: flex;
				align-items: center;

				.left_you {
					width: 29px;
					height: 38px;
					margin-right: 15px;


				}

				.center_you {
					.money {
						font-size: 14px;
						font-family: PingFangSC-Semibold, PingFang SC;
						font-weight: 600;
						color: #000;
						margin-bottom: 10rpx;

						.yuan {
							color: #FC524A;
							font-size: 12px;
						}

						text {
							color: #FC524A;
							font-size: 16px;
						}
					}

					.detil {
						font-size: 24rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #696969;
					}
				}
			}

			.right_you {
				width: 75px;
				height: 34px;
				line-height: 34px;
				text-align: center;
				background: linear-gradient(270deg, #FF456B 0%, #FE5C4F 100%);
				border-radius: 5px;
				font-size: 13px;
				font-family: SourceHanSansCN-Bold, SourceHanSansCN;
				font-weight: bold;
				color: #FFFFFF;
			}

			.right_you2 {
				width: 75px;
				height: 34px;
				line-height: 34px;
				text-align: center;
				background: linear-gradient(270deg, #FF456B 0%, #FE5C4F 100%);
				border-radius: 5px;
				font-size: 13px;
				font-family: SourceHanSansCN-Bold, SourceHanSansCN;
				font-weight: bold;
				color: #FFFFFF;
				opacity: 0.5;
			}

		}
	}

	.list_bot {

		.list_top {
			display: flex;
			align-items: center;
			justify-content: space-between;
			background-color: #fff;
			border-radius: 15rpx;
			padding: 20rpx;
			margin: 0 12px;
			box-sizing: border-box;


			.btnTx {
				width: 75px;
				height: 32px;
				background: linear-gradient(270deg, #FF456B 0%, #FE5C4F 100%);
				border-radius: 5px;
				font-size: 14px;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 32px;
				text-align: center;
			}


			.top_t {
				display: flex;
				align-items: center;

				.top_left {
					display: flex;
					flex-direction: column;

					.top_tit {
						font-size: 13px;
						font-weight: 400;
						color: #131314;
					}

					.top_blod {
						font-size: 21px;
						font-weight: bold;
						color: #FC524A;
						display: flex;
						align-items: baseline;
						margin-top: 5px;

						text {
							font-size: 13px;
							margin-left: 2px;
						}
					}
				}

				.top_right {
					flex: 1;
					display: flex;
					flex-direction: column;
					align-items: center;

					.jiao {
						font-size: 13px;
						font-weight: 400;
						color: #131314;
					}

					.deng {
						font-size: 21px;
						font-weight: bold;
						color: #000;
						display: flex;
						align-items: baseline;
						margin-top: 5px;

						text {
							font-size: 13px;
							margin-left: 2px;
						}
					}
				}
			}

		}
	}

	.top_heade {
		position: relative;
		height: 60px;
		width: 100%;

		.top_wan {
			position: absolute;
			display: flex;
			align-items: center;
			right: 5%;
			top: 50%;
			transform: translateY(-50%);
			z-index: 999;
			// position: relative;


			.wenhao {
				width: 25rpx;
				height: 25rpx;
				margin-right: 10rpx;
			}

			.wanfa {
				font-size: 27rpx;
				font-family: SourceHanSansCN-Medium, SourceHanSansCN;
				font-weight: 500;
				color: #FFFFFF;
			}
		}
	}

	.mina {
		height: 100vh;
		width: 100%;
		background: linear-gradient(180deg, #FE5953 0%, #FFFFFF 100%);
	}

	.sclass {
		height: calc(100vh - 160px);

		h3 {
			color: #000000;
			font-size: 16px;
			margin: 10px 0;
		}
	}

	.grey {
		opacity: 0.5;
	}
</style>